<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
	<link rel="stylesheet" href="../css/reset.css">
	<style>
		body{
			color: #000;
			width:100vw;
			height: 100vh;
			background-image: url(../images/login_bg.jpg);
			background-repeat: no-repeat; 
			background-size: 100% 100%;
			overflow: hidden;
		}
		.box{
			width: 500px;
			height: 300px;
			margin-top: 200px;
			margin-left: 180px;
		}
		.box{
			font-size: 20px;
			
			display: flex;
			justify-content: center;
			flex-direction: column
		}
		.user,.pws{
			display: flex;
			justify-content: center;
			
		}
		label{
			color: #fff;
			margin-right: 10px;
		}
		.user{
			margin-bottom:25px ;
		}
		.reg{
			display: flex;
			justify-content: center;
		}
		.btn{
			display: flex;
			justify-content: center;
		}
		#user,#pws{
			padding-left: 10px;
		}
		.btn button{
			width: 80px;
			height: 35px;
			margin-top: 15px;
			cursor: pointer;
		}
	</style>
</head>
<body>
	<div class="box">
		<div class="user">
			<label for="#user">用户</label> <input type="text" id="user">
		</div>
		<div class="pws">	
			<label for="#pws">密码</label> <input type="password" id="pws">
		</div>
		<div class="reg">	
			没有用户<a href="./regste.html">请注册</a>
		</div>
		<div class="btn">	
			<button onclick="login()">登录</button>
		</div>
	</div>
	<script src="../../public1/js/md5.js"></script>
	<script src="../../public1/js/pubilc.js"></script>
	<script>
		 function login(){
			 if(!user.value||!pws.value){
				return
			 }
			xhr({
				methods:'post',
				url:'/user/getLogin',
				data:JSON.stringify({
					userPhone:user.value,
					password:md5(pws.value),
					rolu:2
				}),
				success:function(res){
					location.replace('./home.html?page=1&token='+res.data.token+"&user="+user.value)
				}
			})
		 }
	</script>
</body>
</html>